#!/bin/sh

PERIOD=5

echo Displaying date, core and battery temperature every $PERIOD seconds

while true; do
    CORE_TEMP=$(dbus-send --system --print-reply --dest=com.nokia.thermalmanager /com/nokia/thermalmanager com.nokia.thermalmanager.core_temperature | grep int32 | tr -s ' ' | cut -d ' ' -f3)
    BATTERY_TEMP=$(dbus-send --system --print-reply --dest=com.nokia.thermalmanager /com/nokia/thermalmanager com.nokia.thermalmanager.battery_temperature | grep int32 | tr -s ' ' | cut -d ' ' -f3)
    echo "`date +\"%x %T\"`   core=$CORE_TEMP battery=$BATTERY_TEMP"
    sleep $PERIOD
done
